//课上练习
const http = require('http');
const fs = require("fs");

const server = http.createServer((req, res) => {
    console.log("received request");
    let filePath = "./demo2.html";
    let fileContent = fs.readFileSync(filePath);
    res.end(fileContent);
});

server.listen(3000);
console.log("server is listening 3000");

//尝试修改demo2.html内容  --发现更新网页后自动修改
//或者修改监听端口，再次访问 --修改js需重新编译node name 刷新页面
//7000端口不可用 见实验手册
//查询防火墙可用端口 sudo firewall-cmd --list-ports